/*    */ package nc.vo.qc.pub.rule;
/*    */ 
/*    */ import nc.impl.pubapp.pattern.rule.IRule;
/*    */ import nc.vo.ml.NCLangRes4VoTransl;
/*    */ import nc.vo.pub.CircularlyAccessibleValueObject;
/*    */ import nc.vo.pub.lang.UFDouble;
/*    */ import nc.vo.pubapp.pattern.exception.ExceptionUtils;
/*    */ import nc.vo.pubapp.pattern.model.entity.bill.AbstractBill;
/*    */ import nc.vo.pubapp.pattern.pub.MathTool;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class CheckBillNumRule<E extends AbstractBill>
/*    */   extends Object
/*    */   implements IRule<E>
/*    */ {
/*    */   private String[] bodyKeys;
/*    */   private String[] headKeys;
/*    */   
/*    */   public CheckBillNumRule(String[] headNumKeys, String[] bodyNumKeys) {
/* 36 */     this.headKeys = headNumKeys;
/* 37 */     this.bodyKeys = bodyNumKeys;
/*    */   }
/*    */ 
/*    */   
/*    */   public void process(E[] bills) {
/* 42 */     for (E e : bills) {
/* 43 */       checkHeadNum(e);
/* 44 */       checkBodyNum(e);
/*    */     } 
/*    */   }
/*    */   
/*    */   private void checkBodyNum(AbstractBill bill) {
/* 49 */     if (this.bodyKeys == null) {
/*    */       return;
/*    */     }
/* 52 */     if (bill.getChildrenVO() == null) {
/*    */       return;
/*    */     }
/* 55 */     for (CircularlyAccessibleValueObject item : bill.getChildrenVO()) {
/* 56 */       for (String bodykey : this.bodyKeys) {
/* 57 */         if (item.getStatus() != 3 && item
/* 58 */           .getAttributeValue(bodykey) != null) {
/*    */ 
/*    */           
/* 61 */           UFDouble num = (UFDouble)item.getAttributeValue(bodykey);
/* 62 */           if (MathTool.lessThan(num, UFDouble.ZERO_DBL)) {
/*    */             
/* 64 */             String msg = NCLangRes4VoTransl.getNCLangRes().getStrByID("c010000_0", "0c010000-0637");
/*    */             
/* 66 */             ExceptionUtils.wrappBusinessException(msg);
/*    */           } 
/* 68 */           if (MathTool.isZero(num)) {
/*    */             
/* 70 */             String msg = NCLangRes4VoTransl.getNCLangRes().getStrByID("c010000_0", "0c010000-0638");
/*    */             
/* 72 */             ExceptionUtils.wrappBusinessException(msg);
/*    */           } 
/*    */         } 
/*    */       } 
/*    */     } 
/*    */   }
/*    */   private void checkHeadNum(AbstractBill bill) {
/* 79 */     if (this.headKeys == null) {
/*    */       return;
/*    */     }
/* 82 */     for (String headkey : this.headKeys) {
/* 83 */       if (bill.getParent().getAttributeValue(headkey) != null) {
/*    */ 
/*    */         
/* 86 */         UFDouble num = (UFDouble)bill.getParent().getAttributeValue(headkey);
/* 87 */         if (MathTool.lessThan(num, UFDouble.ZERO_DBL)) {
/*    */           
/* 89 */           String msg = NCLangRes4VoTransl.getNCLangRes().getStrByID("c010000_0", "0c010000-0639");
/*    */           
/* 91 */           ExceptionUtils.wrappBusinessException(msg);
/*    */         } 
/* 93 */         if (MathTool.isZero(num)) {
/*    */           
/* 95 */           String msg = NCLangRes4VoTransl.getNCLangRes().getStrByID("c010000_0", "0c010000-0640");
/*    */           
/* 97 */           ExceptionUtils.wrappBusinessException(msg);
/*    */         } 
/*    */       } 
/*    */     } 
/*    */   }
/*    */ }


/* Location:              E:\zhuhai_ncc\NCC2111\modules\qc\lib\pubqc_pub.jar!/nc/vo/qc/pub/rule/CheckBillNumRule.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.0.7
 */